import { InputQuestion, QuestionBase, TimeQuestion, SelectQuestion } from '@/components/public-template';
import { TextTable } from '@/components/public-template';
import { TableBase } from '@/components/public-template';
import { Api as ApiSystem } from '@/config/api/system';

class HomeService {
  getQuestions() {
    const questions: QuestionBase<any>[] = [
      new InputQuestion({
        key: 'billCode',
        label: '归档单据编号',
        value: null
      }),
      new InputQuestion({
        key: 'name',
        label: '文件名称',
        value: null
      }),
      new InputQuestion({
        key: 'code',
        label: '文件编码',
        value: null
      }),
      new TimeQuestion({
        key: 'startTime',
        label: '档案接收时间',
        value: [],
        state: {
          showTime: true,
          format: 'YYYY-MM-DD HH:mm:ss',
          valueFormat: 'YYYY-MM-DD HH:mm:ss',
          keySplit: ['startTime', 'endTime']
        }
      }),
      new InputQuestion({
        key: 'filesBoxCode',
        label: '档案编码',
        value: null
      }),
      new SelectQuestion({
        key: 'secretLevel',
        label: '保密等级',
        value: [],
        defaultValue: [],
        type: 'dictionary',
        state: {
          mode: 'multiple',
          filterName: 'SECRET_LEVEL'
        }
      })
    ];
    return questions;
  }
  getTables() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'billCode',
        value: '归档单据编号',
        type: 'router',
        columns: { width: 150 },
        state: {
          type: 'url',
          url: 'ArchivesManageAddFile',
          params: [{ id: 'billId' }],
          state: {
            assign: { showType: 'VIEW' }
          }
        }
      }),
      new TextTable({
        key: 'name',
        value: '文件名称'
      }),
      new TextTable({
        key: 'code',
        value: '文件编码',
        columns: { width: 150 }
      }),
      new TextTable({
        key: 'type',
        value: '载体形式',
        type: 'dictionary',
        state: {
          filterName: 'CARRIER_TYPE'
        }
      }),
      new TextTable({
        key: 'filePages',
        value: '文件页数'
      }),
      new TextTable({
        key: 'retentionPeriodDate',
        value: '保管期限',
        type: 'dictionary',
        state: {
          filterName: 'DMS_ARCHIVES_FILE_LIST_RETENTION_PERIOD_DATE'
        }
      }),
      new TextTable({
        key: 'filesTypeName',
        value: '档案类型'
      }),
      new TextTable({
        key: 'secretLevel',
        value: '保密等级',
        type: 'dictionary',
        state: {
          filterName: 'SECRET_LEVEL'
        }
      }),
      new TextTable({
        key: 'filesBoxCode',
        value: '档案编码'
      }),
      new TextTable({
        key: 'adminByName',
        value: '档案管理员'
      }),
      new TextTable({
        key: 'receiveTime',
        value: '档案接收时间',
        columns: { width: 200 }
      })
    ];
    return tables;
  }
  getIcons() {
    const icons: TableBase<any>[] = [
      new TextTable({
        key: 'local',
        value: '存档录入',
        type: 'primary',
        class: 'icon-add',
        state: {}
      })
    ];
    return icons;
  }
}

export default new HomeService();
